<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<p id="msg">上课不听讲，一般只有三种情况：1.手里有个手机 2.心里有个美女 3.身边做个逗比</p>
	<p id="mssg">上课不听讲，一般只有三种情况：1.手里有个手机 2.心里有个美女 3.身边做个逗比</p>
	<hr>
	<font id="show" size="6"></font>
</body>
<script>
	var msg = document.getElementById('msg');
	var mssg = document.getElementById('mssg');
	function test(){
		var str = msg.innerHTML;
		msg.innerHTML = str.substr(1)+str.charAt(0);
	}
	
	function text(){
		var str =  mssg.innerHTML;
		str = str.split("");
		str.push(str.shift());
		mssg.innerHTML = str.join("");
	}
	setInterval('test()',100);
	setInterval('text()',100);

	//文字跑马灯
	var message = 'JavaScript And PHP';
	var i = 0 ;
	setInterval(function(){
		if(i>=message.length)  i=0;
		document.getElementById('show').innerHTML = show(i,message);
		i++;
	},100);

	function show(i,str){
		var tmp = str.substr(0,i);
		tmp += '<font color=red size=7>'+str[i]+'</font>';
		tmp += str.substr(i+1);
		return tmp;
	}
</script>
</html>